import lessModule from "./index.module.less"
import { Button } from "antd"
import { $eventBus } from "../../../../../../common/utils"
interface homePageModalComponentNormalFooterComponentInterface {
    isSubmitHide?: boolean
    cancelName?: string
    submitName?: string
    change_cancel: Function
}
// 主页-弹窗组件-通用底部组件
const HomePage_ModalComponent_NormalFooterComponent: React.FC<homePageModalComponentNormalFooterComponentInterface> = (props) => {
    const click_submit = () => {
        setTimeout(() => {
            $eventBus.emit("submitOperation", { source: "HomePage_ModalComponent_NormalFooterComponent", explain: "请执行弹窗通用底部组件的确定事件" })
        });
    }
    return (
        <footer className={lessModule["homePageModalComponentNormalFooterComponent"]} style={{gap:props.isSubmitHide ? 0 : 8}}>
            <Button onClick={() => props.change_cancel()}>{props.cancelName ?? "取消"}</Button>
            {
                !props.isSubmitHide && <Button type="primary" onClick={() => click_submit()}>{props.submitName ?? "确定"}</Button>
            }
        </footer>
    )
}

export default HomePage_ModalComponent_NormalFooterComponent